<template>
	<view class="info_warp">
		<view class="form_box">
			<form class="formbg">
				<u-form-item class="uformitem" :label-position="labelPosition" label="收件人" prop="accept_name" label-width="150">
					<u-input :border="border" placeholder="收件人姓名" v-model="user.accept_name" type="text"></u-input>
				</u-form-item>
				
				<u-form-item class="uformitem" :label-position="labelPosition" label="所在地区" prop="name" label-width="150">
					<picker mode="multiSelector" @change="RegionChange" @columnchange="columnchange" :value="region" :range="regions" range-key="fullname">
						<view class="picker">
							{{cprovince.fullname}}，{{ccity.fullname}}，{{ccounty.fullname}}
						</view>
					</picker>
				</u-form-item>
				
				<u-form-item class="uformitem" :label-position="labelPosition" label="收货地址" prop="address" label-width="150">
					<input placeholder="输入详细收货地址" name="address" v-model="user.address"></input>
				</u-form-item>
				
				<u-form-item class="uformitem" :label-position="labelPosition" label="手机号码" prop="mobile" label-width="150">
					<input placeholder="输入手机号码" name="mobile" v-model="user.mobile"></input>
				</u-form-item>
				
				<u-form-item class="uformitem" :label-position="labelPosition" label="默认地址" prop="switchD" label-width="150">
					<u-switch slot="right" v-model="switchD" activeColor="#35c877" @change="SwitchD" ></u-switch>
				</u-form-item>
				
				<view class="submitBtn">
					<u-button type="success" @click="saveadd" shape="circle">提交保存</u-button>
				</view>
			</form>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:0,
				type: '',
				user: {},
				switchD: false,
			
				province: '',
				city: '',
				county: '',
				region: [],
				dprovince:[],
				dcity: [],
				dcounty: [],
				cprovince:{},
				ccity:{},
				ccounty:{},
				
				info: {},
				
				border: false,
				labelPosition: 'left'
			};
		},
		computed:{
			regions:function(){
				return [
					[{area_id:'',fullname:'请选择'}].concat(this.dprovince),
					[{area_id:'',fullname:'请选择'}].concat(this.dcity),
					[{area_id:'',fullname:'请选择'}].concat(this.dcounty)
				];
			}
		},
		methods: {
			SwitchD(value) {
				this.switchD = value;
			}
		}
	}
</script>

<style lang='scss'>
	page {
		background: #f1f1f1;
	}
	.u-form-item {
		padding: 11px 17px;
	}
	.submitBtn {
		padding: 20px 17px;
	}
	.formbg {
		width: 100%;
		display: table;
	}
</style>
